package com.wb.core08_常用类.泛类;

/**
 * @author 黄衡熙
 * @version 1.0
 */
public class Person implements CompareInterface<Person> {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public int compareTo(Person person) {
        if (this.age > person.getAge()) {
            return 1;
        } else if (this.age == person.getAge()) {
            return 0;
        }
        return -1;
    }
}